package cn.securityformail.rabbitmq.workquene;

import cn.securityformail.rabbitmq.util.RabbitMQUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import org.junit.Test;

import java.io.IOException;

public class Provide {
    @Test
    public void send() throws IOException {
        Connection connection = RabbitMQUtil.getConnection();

        Channel channel = connection.createChannel();

        channel.queueDeclare("work",true,false,false,null);

        for (int i = 0; i < 10; i++) {
            channel.basicPublish("","work",null,(i+"hello RabbitMQ").getBytes());
        }

        RabbitMQUtil.closeConnectionAndChanel(channel,connection);

    }
}
